﻿using Unity.Netcode;
using UnityEngine;

public class WeaponPoolHandler : MonoBehaviour 
{
    [SerializeField] GameObject bulletPrefab;
    NGOPool<Bullet> bulletPool;

    private void Start()
    {
        bulletPool = new(bulletPrefab, maxNum: 10);
        NetworkManager.Singleton.PrefabHandler.AddHandler(bulletPrefab, bulletPool);
    }

    private void OnDestroy()
    {        
        if(NetworkManager.Singleton!=null)
            NetworkManager.Singleton.PrefabHandler.RemoveHandler(bulletPrefab);
    }
}
